import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;

public class ClassManager {
    // Initialize the classes map at declaration
    private final Map<String, GroupManager> classes = new HashMap<>();

    public void addClass(String className) {
        // Ensure the class is added only if it doesn't exist already
        classes.putIfAbsent(className, new GroupManager());
    }

    public GroupManager getClassGroups(String className) {
        // Return the GroupManager associated with the class, or create a new one if not found
        return classes.computeIfAbsent(className, k -> new GroupManager());
    }

    public List<String> getClassList() {
        return new ArrayList<>(classes.keySet());
    }
}